<!DOCTYPE html>
<html>

	<!-- Mirrored from www.zi-han.net/theme/hplus/table_jqgrid.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 20 Jan 2016 14:20:02 GMT -->

	<head>

		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">

		<title>评论详情</title>

		<!-- <link rel="shortcut icon" href="favicon.ico"> -->
		<link href="css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
		<link href="css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">

		<link href="css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
		<link href="css/plugins/iCheck/custom.css" rel="stylesheet">
		<link href="css/animate.min.css" rel="stylesheet">
		<link href="css/style.min862f.css?v=4.1.0" rel="stylesheet">
		<link rel="stylesheet" href="css/cropper.min.css">
		<link rel="stylesheet" href="css/ImgCropping.css">
		<link rel="stylesheet" href="css/newStyle.css">
		<link href="js/plugins/fancybox/jquery.fancybox.css" rel="stylesheet">

		<style>
			input::-webkit-outer-spin-button,
			input::-webkit-inner-spin-button {
				-webkit-appearance: none;
			}
			input[type="number"]{
				-moz-appearance: textfield;
			}
			.dt_title_btn{
				width: 100px;height: 30px;cursor: pointer;text-align: center;line-height: 30px;box-sizing: border-box;border-width: 1px;border-style: solid;border-color: rgba(228, 228, 228, 1);text-align: center;
			}
			.flexw100{width:100%;display: flex;align-items: center;}
			.flex_shu{flex-direction: column;}
			.thl{
				width: 16%!important;text-align: right!important;padding-right: 30px!important;
			}
			.thr{
				width: 34%!important;background-color:#fff!important;text-align: left!important;padding-left: 30px!important;
			}
			.w50{
				width: 50%;
			}
			.mr30{
				margin-right: 30px;
			}
			.tac{
				text-align: center;
			}
			.lh50{
				line-height: 50px;
			}
			.m0a{
				margin: 0 auto;
			}
		</style>
	</head>

	<body class="gray-bg">
		<div class="animated fadeInRight">
			<div style="width: 100%;height: 50px;background-color: rgba(243, 243, 243, 1);display: flex;align-items: center;">
				<div class="" style="width: 50%;display: flex;">
					<div class="pull-left">
						<div class="ibox-tools cache5 ml30">
							评价详情
						</div>
					</div>
				</div>
				<div style="width: 50%;display: flex;justify-content:flex-end;">
					<button class="refresh_btn mr30">
						<a class="refresh_a" style="">
							<i class="fa fa-refresh"></i> 刷新
						</a>
					</button>
					<button class="refresh_btn mr30">
						<a class="goback_a" style="">
							<span class="titleBackIcon"></span> 返回
						</a>
					</button>
				</div>
			</div>

			<div style="display: flex;border: 1px solid rgba(228, 228, 228, 1);width: 1100px;margin-left: 80px;margin-top: 30px;background-color: #fff;">
				<div style="width: 300px;height: 500px;display: flex;align-items: center;flex-direction: column;border-right: 1px solid rgba(228, 228, 228, 1);">
					<div style="width: 80px;height: 80px;border-radius: 50%;overflow: hidden;border: 3px solid #999999;margin-top: 60px;"><img
						 id="head_ico" style="width: 100%;" src="" alt=""></div>
					<div id="nick" style="margin-top: 10px;"></div>
					<div style="margin-top: 10px;"><span>服务名称：</span><span id="goods_name"></span></div>
					<div style="margin-top: 10px;"><span>商品评价：</span><span id="technStatus"></span></div>
					<div style="margin-top: 10px;"><span>评论时间：</span><span id="create_time"></span></div>
				</div>
				<div style="width: 800px;display: flex;align-items: center;flex-direction: column;padding:0 80px;padding-top: 20px;">
					<div class="w100p m0a" style="height: 50px;line-height:50px;border-bottom: 1px solid rgba(228, 228, 228, 1);">
						<!-- 	<span>收藏1000</span>
						<span>阅读1000</span> -->
					</div>
					<div style="line-height: 40px;padding: 50px 0;width:100%;" id="center"></div>

					<div class="w100p" id="picBox" style="display: flex;align-items: center;flex-direction:row;">
					</div>

					<div class="w100p" style="height:50px;line-height:50px;margin-top:20px;border-bottom:1px solid rgba(228, 228, 228, 1);"><span>回复评价</span></div>
					<div class="w100p">
						<div class="w100p" id="replyArea" style="min-height:120px;display:flex;padding-top: 20px;">
							<div class="huifufu w100p">
								<div style="width:15%;"><span style="color:red;">*</span>回复内容<span></span></div>
								<div style="width:85%;padding:10px;"><textarea style="width:100%;height:150px;" class="centerSend"></textarea>
									<div style="width:100%;margin-top:20px;">
										<div style="width: 80px;height: 30px;line-height:30px;background: inherit;background-color: rgba(26, 188, 156, 1);cursor: pointer;border: none;border-radius: 3px;float:left;color:#fff;text-align:center;"
										 class="sendBtn">确定</div>
										<div style="float:left;margin-left:30px;height: 30px;line-height:30px;">注意：管理员回复内容会在前台显示</div>
										<!-- <div style="float:right;height: 30px;line-height:30px;">0/500</div> -->
									</div>
								</div>
							</div>
						</div>
					</div>

					<div class="w100p" style="height:50px;line-height:50px;margin-top:20px;border-bottom:1px solid rgba(228, 228, 228, 1);"><span>全部评论
							<span id="comment_count"></span></span></div>
					<div class="w100p" id="allCommentArea" style="min-height: 80px;padding-bottom: 50px;">

						<!-- <div class="flexw100" style="height: 112px;display: flex;align-items: center;border-bottom:1px solid rgba(228, 228, 228, 1);">
							<div style="width: 20%;display: flex;align-items: center;"><img style="width: 60px;height: 60px;margin: 0 auto;background-color: lavender;border-radius: 50%;" src="" alt=""></div>
							<div style="width: 80%;line-height: 30px;">
								<div>嗷嗷</div>
								<div>回复Windir：看来大家都是懒人呀！</div>
								<div>2017-06-15 14:35:51   隐藏   删除</div>
							</div>
						</div> -->

					</div>

				</div>
			</div>
		</div>

		<script src="js/jquery-2.1.0.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/bootstrap.min.js?v=3.3.6"></script>
		<script src="js/plugins/peity/jquery.peity.min.js"></script>
		<script src="js/content.min.js?v=1.0.0"></script>
		<script src="js/plugins/layer/laydate/laydate.js"></script>
		<script src="js/plugins/sweetalert/sweetalert.min.js"></script>
		<script src="js/plugins/iCheck/icheck.min.js"></script>
		<script src="js/common.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/cropper.min.js"></script>
		<script src="js/plugins/fancybox/jquery.fancybox.js"></script>
		<script>
			var tableTimeout, addManageTimeout, setRoleTime, editManageTimeout, deleteTimeOut, getPowerList, powerName = "",
				limits = 20,
				page = 1,
				counts = 0,
				table_title;
			var nick = "";
			var goodsId = getURLParams(document.URL).id;
			var phone = getURLParams(document.URL).phone;
			var goodsnum = getURLParams(document.URL).goodsnum;
			var headIco;

			$(document).ready(function() {
				IsTokenSave();
				$(".fancybox").fancybox({
					openEffect: "none",
					closeEffect: "none"
				});
				$(".refresh_a").click(function() { //刷新按钮
					location.reload();
				});
				$(".goback_a").click(function() { //刷新按钮
					history.go(-1);
				});
				InitTbodyList(goodsId);

			});
			/**
			 * 该方法用于初始化操作列里的事件
			 * */

			function InitTbodyList() {
				Showload("正在初始化列表......");
				tableTimeout = setInterval("Timeout(tableTimeout)", 1000);
				$.ajax({
					type: "get",
					url: urls + common_url.technologyService_detailsList,
					async: true,
					timeout: 30000,
					dataType: "json",
					headers: {
						'X-Access-Token': userMessage.token,
					},
					data: {
						id: goodsId
					},
					success: function(json) {
						console.log(json);
						CheckLogout(json); //检查是否登陆过期
						if (json.code == 0) {
							// totalPages = json.data.records.total;
							var myData = json.data;
							nick = myData.nick;
							headIco = myData.head_ico;
							$("#nick").html(myData.nick);
							$("#head_ico").attr("src", imgUrl + myData.head_ico);
							$("#goods_name").html(myData.goods_name);
							$("#technStatus").html(myData.technStatus);
							$("#center").html(myData.center);
							$("#create_time").html(myData.create_time);
							var picHtml = '';
							for (var i = 0; i < myData.pic.length; i++) {
								picHtml = picHtml +
									'<div style="width:100px;height:100px;margin-right:30px;border:1px solid rgba(228, 228, 228, 1);overflow:hidden;"><a class="fancybox" href="' +
									imgUrl + myData.pic[i].goods_comments_pic +
									'" title="图片浏览"><img style="width:100%;" src="' + imgUrl + myData.pic[i].goods_comments_pic + '"></a></div>'
							}
							$("#picBox").html(picHtml);
							if (myData.huifuCenter == null) {
								console.log(111);
							} else {
								console.log(222);
								$("#replyArea").html(myData.huifuCenter);
							}
							InitFunc();
							// DealTable();

						} else {
							TipsAlert(json.msg);
							// if (json.return_msg == "Session过期") {
							// 	window.location = "login_timeout.html";
							// }else{
							// 	TipsAlert(json.return_msg);
							// }
						}
						InitTime(tableTimeout);
					},
					error: function(xml, text, errorThrown) {
						if (text == "timeout") {
							TipsAlert("请求超时,请检查网络或着重新打开该页面.");
						} else {
							TipsAlert("请求数据失败,请联系后台技术人员");
						}
						InitTime(tableTimeout);
					}

				});
				$.ajax({
					type: "get",
					url: urls + common_url.technologyService_CommentList,
					async: true,
					timeout: 30000,
					dataType: "json",
					headers: {
						'X-Access-Token': userMessage.token,
					},
					data: {
						goodsNum: goodsnum,
						page: 1,
						limit: 10,
					},
					success: function(json) {
						console.log(json);
						CheckLogout(json); //检查是否登陆过期
						if (json.code == 0) {
							// totalPages = json.data.records.total;
							var myData = json.data.records;
							var commentHtml = '';
							$("#comment_count").html(json.data.total);
							for (var i = 0; i < myData.length; i++) {
								if (myData[i].is_display_yes_no == 1) { //1显示2隐藏
									myData[i].isShow = 2;
									myData[i].isShow_input = "隐藏"
								} else {
									myData[i].isShow = 1;
									myData[i].isShow_input = "显示"
								}
								commentHtml = commentHtml +
									'<div class="flexw100" style="height: 112px;display: flex;align-items: center;border-bottom:1px solid rgba(228, 228, 228, 1);"><div style="width: 20%;display: flex;align-items: center;"><img style="width: 60px;height: 60px;margin: 0 auto;background-color: lavender;border-radius: 50%;" src="' +imgUrl + myData[i].head_ico + '" alt=""></div><div style="width: 80%;line-height: 30px;"><div>' + myData[i].hfUser + '</div><div>回复' + myData[i].plUser + '：' + myData[i].center +
									'</div><div>'+myData[i].create_time+'   <span class="under_line cursor_pointer hide_span pl20 c_1ABC9C" data-id="' +
									myData[i].id + '" data-isshow="' + myData[i].isShow + '">' + myData[i].isShow_input +
									'</span>   <span class="under_line cursor_pointer delete_span pl20 c_1ABC9C" data-id="' + myData[i].id +
									'" data-isshow="' + myData[i].isShow + '">删除</span> </div></div></div>'
							}
							$("#allCommentArea").html(commentHtml);
							console.log()
							InitFunc();
						} else {
							TipsAlert(json.msg);
							// if (json.return_msg == "Session过期") {
							// 	window.location = "login_timeout.html";
							// }else{
							// 	TipsAlert(json.return_msg);
							// }
						}
						InitTime(tableTimeout);
					},
					error: function(xml, text, errorThrown) {
						if (text == "timeout") {
							TipsAlert("请求超时,请检查网络或着重新打开该页面.");
						} else {
							TipsAlert("请求数据失败,请联系后台技术人员");
						}
						InitTime(tableTimeout);
					}

				});

			}

			function InitFunc() {

				$(".hide_span").each(function() {
					$(this).click(function() {
						var dataset = $(this)[0].dataset;
						console.log(dataset);
						swal({
							title: "提示",
							text: "确定要执行吗？请谨慎操作！",
							type: "warning",
							showCancelButton: true,
							confirmButtonColor: "#DD6B55",
							confirmButtonText: "是的",
							cancelButtonText: "让我再考虑一下…",
							closeOnConfirm: false,
						}, function(e) {
							if (e) {
								swal({
									title: "提示？",
									text: "请再次确认",
									type: "warning",
									showCancelButton: true,
									confirmButtonColor: "#DD6B55",
									confirmButtonText: "是的",
									cancelButtonText: "让我再考虑一下…",
									closeOnConfirm: false,
									closeOnCancel: true
								}, function(yes) {
									if (yes) {
										Showload("正在请求数据，请稍后....");
										deleteTimeOut = setInterval("Timeout(deleteTimeOut)", 1000);
										$.ajax({
											type: "get",
											url: urls + common_url.technologyService_showOrHiden,
											async: true,
											timeout: 30000,
											dataType: "json",
											headers: {
												'X-Access-Token': userMessage.token,
											},
											data: {
												id: dataset.id,
												showOrHiden: dataset.isshow,
											},
											success: function(json) {
												CheckLogout(json);
												if (json.code == 0) {
													swal({
														title: "操作成功！",
														text: "通过",
														type: "success",
													}, function() {
														location.reload();
													});
												} else {
													TipsAlert("错误：" + json.msg + ",原因:" + json.error);
												}
												InitTime(deleteTimeOut);
											},
											error: function(xml, text, e) {
												if (text == "timeout") {
													TipsAlert("请求超时,请检查网络或着重新操作");
												} else {
													TipsAlert("请求数据失败,请联系后台技术人员");
												}
												InitTime(deleteTimeOut);
											}
										});
									}
								});
							}
						});

					});
				});

				$(".delete_span").each(function() {
					$(this).click(function() {
						var dataset = $(this)[0].dataset;
						console.log(dataset);
						swal({
							title: "提示",
							text: "确定要删除吗？请谨慎操作！",
							type: "warning",
							showCancelButton: true,
							confirmButtonColor: "#DD6B55",
							confirmButtonText: "是的",
							cancelButtonText: "让我再考虑一下…",
							closeOnConfirm: false,
						}, function(e) {
							if (e) {
								swal({
									title: "提示？",
									text: "请再次确认",
									type: "warning",
									showCancelButton: true,
									confirmButtonColor: "#DD6B55",
									confirmButtonText: "删除",
									cancelButtonText: "让我再考虑一下…",
									closeOnConfirm: false,
									closeOnCancel: true
								}, function(yes) {
									if (yes) {
										Showload("正在请求数据，请稍后....");
										deleteTimeOut = setInterval("Timeout(deleteTimeOut)", 1000);
										$.ajax({
											type: "get",
											url: urls + common_url.technologyService_delete,
											async: true,
											timeout: 30000,
											dataType: "json",
											headers: {
												'X-Access-Token': userMessage.token,
											},
											data: {
												id: dataset.id,
											},
											success: function(json) {
												CheckLogout(json);
												if (json.code == 0) {
													swal({
														title: "操作成功！",
														text: "通过",
														type: "success",
													}, function() {
														location.reload();
													});
												} else {
													TipsAlert("错误：" + json.msg + ",原因:" + json.error);
												}
												InitTime(deleteTimeOut);
											},
											error: function(xml, text, e) {
												if (text == "timeout") {
													TipsAlert("请求超时,请检查网络或着重新操作");
												} else {
													TipsAlert("请求数据失败,请联系后台技术人员");
												}
												InitTime(deleteTimeOut);
											}
										});
									}
								});
							}
						});

					});
				});


				$(".sendBtn").click(function() {
					console.log($(".centerSend").val());
					swal({
						title: "提示",
						text: "是否确定回复？",
						type: "warning",
						showCancelButton: true,
						confirmButtonColor: "#DD6B55",
						confirmButtonText: "是的",
						cancelButtonText: "让我再考虑一下…",
						closeOnConfirm: false,
						closeOnCancel: true
					}, function(yes) {
						if (yes) {
							Showload("正在请求数据，请稍后....");
							deleteTimeOut = setInterval("Timeout(deleteTimeOut)", 1000);
							$.ajax({
								type: "get",
								url: urls + common_url.technologyService_Evaluation,
								async: true,
								timeout: 30000,
								dataType: "json",
								headers: {
									'X-Access-Token': userMessage.token,
								},
								data: {
									id: goodsId,
									center: $(".centerSend").val(),
									token: userMessage.token
								},
								success: function(json) {
									CheckLogout(json);
									if (json.code == 0) {
										swal({
											title: "操作成功！",
											text: "通过",
											type: "success",
										}, function() {
											location.reload();
										});
									} else {
										TipsAlert("错误：" + json.msg + ",原因:" + json.msg);
									}
									InitTime(deleteTimeOut);
								},
								error: function(xml, text, e) {
									if (text == "timeout") {
										TipsAlert("请求超时,请检查网络或着重新操作");
									} else {
										TipsAlert("请求数据失败,请联系后台技术人员");
									}
									InitTime(deleteTimeOut);
								}
							});
						}
					});
				})

				function changeLength(obj, num) {
					obj.on('keyup', function() {
						var txtval = obj.val().length;
						//console.log(txtval);
						var str = parseInt(600 - txtval);
						//console.log(str);
						if (str > 0) {
							num.html('剩余可输入' + str + '字');
						} else {
							num.html('剩余可输入0字');
							obj.val(obj.val().substring(0, 600));
						}
						//console.log($('#num_txt').html(str));
					});
				}
			}
		</script>
	</body>
</html>
